package entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

@Entity
@DiscriminatorValue(value="GENERAL")
public class DepositoGeneralEntity extends DepositoEntity implements Serializable{
	
	@Transient
	private static final long serialVersionUID = 1L;
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="idDeposito")
	private List<ItemDepositoEntity> insumos = new ArrayList<ItemDepositoEntity>();

	public DepositoGeneralEntity() {
	}

	public List<ItemDepositoEntity> getInsumos() {
		return insumos;
	}

	public void setInsumos(List<ItemDepositoEntity> insumos) {
		this.insumos = insumos;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((insumos == null) ? 0 : insumos.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		DepositoGeneralEntity other = (DepositoGeneralEntity) obj;
		if (insumos == null) {
			if (other.insumos != null)
				return false;
		} else if (!insumos.equals(other.insumos))
			return false;
		return true;
	}
	
	
	

}
